﻿<%@ Page Title="" Language="C#" MasterPageFile="~/PortalParts/Portal.Master" AutoEventWireup="true" CodeBehind="MyReplyList.aspx.cs" Inherits="ZHDJ.Web.Portal.Forum.MyReplyList" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="../../Resource/themes/Default/CSS/party.common.css" rel="stylesheet" type="text/css" />
    <link href="../../Resource/themes/Default/CSS/portal.widgets.css" rel="stylesheet" type="text/css" />
    <link href="../../Resource/themes/Default/CSS/admin.buttons.css" rel="stylesheet" type="text/css" />
    <link href="../../Resource/themes/default/css/party.portal.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .search_btn{
             width:60px;
             height:40px;
			 font-size: 14px;
			 color: #333;
			 cursor: pointer;
        }
    </style>
    <script src="../../Resource/js/default/jquery.tmpl.min.js"></script>
    <script src="../../Resource/js/knockout/knockout-3.4.0.js"></script>
    <script src="../../Resource/js/jquery/jquery.pagination.js"></script>
    <script>
        var pageSize = 30, isBind = false;

        function gotoTop() {
            $("#gototop").click();
        }

        var paginationPara = {
            num_edge_entries: 1, //边缘页数
            num_display_entries: 4, //主体页数
            callback: pageselectCallback,
            items_per_page: pageSize, //每页显示1项
            prev_text: "上一页",
            next_text: "下一页",
            link_to: "javascript:void(0);",
            current_page: 0 //当前页面,
        }
        var ViewModel = {
            qdate: ko.observableArray(),
            loadContacts: function (pageIndex) {
                $.get("MyReplyList.aspx", {
                    PageIndex: pageIndex,
                    PageSize: pageSize,
                    TypeID: $("#ctl00_ContentPlaceHolder1_hdTypeID").val(),
                    ForumOrderby: $("#ctl00_ContentPlaceHolder1_hdForumOrderby").val(),
                    QueryText: $("#QueryText").val(),
                    r: (new Date()).getTime()
                },
                function (data) {
                    var ss = eval("(" + data + ")");

                    ViewModel.qdate(eval("(" + data + ")"));
                });
            }
        }

        function initPage() {
            if (isNaN(querystring("Page"))) {
                $("#linkSpan").parent().attr("href", "#Page=" + querystring("Page"));
            } else {
                $("#linkSpan").parent().attr("href", "#Page=0" );
            }

            $("#linkSpan").click();
            $.get("MyReplyList.aspx",
                {
                    DataCount: 1,
                    TypeID: $("#ctl00_ContentPlaceHolder1_hdTypeID").val(),
                    ForumOrderby: $("#ctl00_ContentPlaceHolder1_hdForumOrderby").val(),
                    r: (new Date()).getTime()
                },
                function (data) {
                    var totalCount = parseInt(data);
                    paginationPara.current_page = querystring("Page");
                    $("#pagination").pagination(totalCount, paginationPara);
                });
        }
        function pageselectCallback(pageIndex, jq) {
            $("#linkSpan").parent().attr("href", "#Page=" + pageIndex);
            $("#linkSpan").click();
            ViewModel.loadContacts(pageIndex);
            if (!isBind) {
                ko.applyBindings(ViewModel);
                isBind = true;
            }

        }

        function querystring(key) {
            var re = new RegExp('(?:\\?|&|#)' + key + '=(.*?)(?=&|$)', 'gi');
            var r = [], m;
            while ((m = re.exec(document.location)) != null) r.push(m[1]);
            return r.toString();
        }
        $(function () {
            initPage();

            $("#btnQuery").click(function () {
                initPage();
            });
           
            $(".orderbyf").each(function (i, n) {
                if ($(n).val() == $("#ctl00_ContentPlaceHolder1_hdForumOrderby").val()) {
                    $(n).attr("checked",'checked');
                }
                $(n).click(function () {
                    $("#ctl00_ContentPlaceHolder1_hdForumOrderby").val($(n).val());
                    initPage();
                });
            });
        });



    </script>
    <script id="myTemplate" type="text/x-jquery-tmpl">
        
        <div class="BBS-List-TitleList">
            <table style='width: 100%;text-align: center;'>
                <tr>
                    <td rowspan="2">
                        <label class="BBS-List-ConTitle">
                            <a href="BBSReplyDetails.aspx?ForumID=${ID}&TypeID=${TypeID}"
                                target="_blank"><span style="color: red;">${IsFirstName}</span>${ForumTitle}</a>
                        </label>
                    </td>
                    <td style="width: 200px;">
                        <label class="BBS-Lis-FontStyle1">
                            ${AuthorName}
                        </label>
                    </td>
                    <td style="width: 200px;">
                        <label class="BBS-Lis-FontStyle2">
                            ${VisitTimes}
                        </label>
                    </td>
                    <td style="width: 200px;">
                        <label class="BBS-Lis-FontStyle1">
                            ${ReplyByName}</label>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label class="BBS-Lis-FontStyle3">
                            ${CreateTimeEx} 
                        </label>
                    </td>
                    <td>
                        <label class="BBS-Lis-FontStyle3">
                            ${ReplyCount}
                        </label>
                    </td>
                    <td>
                        <label class="BBS-Lis-FontStyle3">
                            ${ReplyTimeEx}
                        </label>
                    </td>
                </tr>
            </table>
        </div>
    </script>
    <style type="text/css">
        .auto-style1 {
            width: 15%;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    
    <asp:HiddenField ID="hdDefaultPageIndex" runat="server" Value="0" />
    <div style="display:none"><a href="#PageIndex"><span id="linkSpan"></span></a></div>
    <div class="party-navigation" style="border: none;">
        当前位置：<a href="../../Default.aspx">首页</a> > <a href="BBSIndex.aspx">论坛首页</a> > 我的回复
    </div>
	<div class="bgline"></div>
	<div class="mywrap">
        <div class="mywrapleft">我的回复</div>
    </div>
    <div style="padding-right:2px">
    <asp:HiddenField ID="hdTypeID" runat="server" />
    <asp:HiddenField ID="hdForumOrderby" runat="server" />
    
    <div class="BBS-Title DivWidth">
        <div style="width: 100%;overflow:hidden;margin: 20px auto;">
            <div style="float: left;margin-right:20px;height: 36px;line-height: 36px;font-size: 16px;color: #333;">
                <asp:Label ID="lbl" runat="server">标题</asp:Label>
            </div>
            <div style="float: left;margin-right:20px;">
                <input id="QueryText" type="text" style="height: 36px;line-height: 36px;padding: 0 10px;" />
            </div>
            <div style="float: left;">                    
                <button type="button" class="search_btn" id="btnQuery">搜索</button>
            </div>
        </div>
    </div>
    <div class="BBS-List DivWidth">
        <div class="BBS-List-title">
            <table style="width: 100%;text-align: center;">
                <tr style="height: 50px;line-height:50px;">
                    <td style="width: auto">标题</td>
                    <td style="width: 200px;">作者</td>
                    <td style="width: 200px;">查看/回复</td>
                    <td style="width: 200px;">最后发表</td>
                </tr>
            </table>
        </div>
        <div class="BBS-List-Con" data-bind="template: { name: 'myTemplate', foreach: qdate}">
           
        </div>
    </div>
    <div class="DivWidth">
        <div class="pagination">
			<div id="pagination"></div>
		</div>
    </div>
    <span id="gototop"><a href="#"></a></span>
        </div>
</asp:Content>
